package com.ymatou.iapi.prodlist.service;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.ymatou.iapi.productquery.compare.ProductQueryInterface;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.MapUtil;

public class GetCatalogListByDeliveryExtraIsolationCall extends YmatouAutoTestCall implements ProductQueryInterface{
	private static String opurl="/api/Product/GetCatalogListByDeliveryExtraIsolation";
	
	public GetCatalogListByDeliveryExtraIsolationCall(){
		super(EnvSetup.getSystemUrl("prodlist"), opurl, "POST", "JSON");
	}
	
	
	@Override
	public void addDefHeader(){
		client.addHeader("Content-Type", "application/json");
	}
	
	 
	@Override
	public JSONObject search(List<String> catalogIdAndType) {
		
		JSONObject catalogInfo = new JSONObject();
		try {
			catalogInfo.put("CatalogId", catalogIdAndType.get(0));
			catalogInfo.put("DeliveryType", Integer.parseInt(catalogIdAndType.get(1)));
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		JSONArray CatalogList = new JSONArray();
		CatalogList.put(catalogInfo);
		
		JSONObject requestBean = this.getJsonBean(null);
		JsonBeanHelper.updateJsonBean(requestBean, MapUtil.hashMap("CatalogList",CatalogList));
		return callAndGetReturnData(requestBean);
	}
	
	

	
	public static void main(String[] args) {
		List<String> aList = new ArrayList<>();
		aList.add("c44d28c6-39ef-421f-aed7-760014a93faf");
		aList.add("2");
		new GetCatalogListByDeliveryExtraIsolationCall().search(aList);
	}
}
